"""Dataclasses and typed definitions used across the application."""

from __future__ import annotations

from dataclasses import dataclass
from typing import Callable, Dict, List, Optional, Tuple, TYPE_CHECKING

import numpy as np

if TYPE_CHECKING:
    from .context import PipelineContext


@dataclass
class ParameterDefinition:
    name: str
    label: str
    type: str  # int, float, choice, bool, text
    minimum: Optional[float] = None
    maximum: Optional[float] = None
    default: object = None
    step: float = 1.0
    decimals: int = 0
    choices: Optional[List[Tuple[str, object]]] = None


@dataclass
class OperationDefinition:
    key: str
    label: str
    category: str
    parameters: List[ParameterDefinition]
    apply_func: Callable[["PipelineContext", Dict[str, object]], np.ndarray]


@dataclass
class PipelineStep:
    definition: OperationDefinition
    params: Dict[str, object]
    enabled: bool = True
    step_id: int = 0
